/* 现代化商城网站样式 - 简约现代风格 */
:root {
    --primary-color: #4263eb; /* 现代蓝色主题 */
    --primary-light: #eef2ff;
    --primary-dark: #364fc7;
    --secondary-color: #00b8d9;
    --success-color: #0ca678;
    --danger-color: #fa5252;
    --warning-color: #f59f00;
    --info-color: #339af0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --white-color: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* 基础样式重置 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器样式 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 头部导航栏 */
.header-nav {
    background-color: var(--white-color);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.header-nav:hover {
    box-shadow: var(--shadow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand:hover {
    color: var(--primary-dark);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    display: inline-block;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* 下拉菜单指示器 */
.nav-links li.has-dropdown > a::after {
    content: '▼';
    font-size: 0.75rem;
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.nav-links li.has-dropdown:hover > a::after {
    transform: rotate(180deg);
}

/* 用户操作区域 */
.user-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    font-weight: 500;
    color: var(--gray-700);
    padding: 0.5rem;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--white-color);
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.5;
    letter-spacing: 0.025em;
}

.btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #e03131;
}

.btn-success {
    background-color: var(--success-color);
}

.btn-success:hover {
    background-color: #099268;
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.btn-warning:hover {
    background-color: #e67700;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* 页面标题 */
.page-title {
    text-align: center;
    margin: 2rem 0;
    color: var(--gray-900);
}

.page-title h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* 卡片样式 */
.card {
    background-color: var(--white-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1rem 1.5rem;
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: var(--gray-50);
    border-top: 1px solid var(--border-color);
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--white-color);
    color: var(--gray-800);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 99, 235, 0.1);
}

.form-control:invalid {
    border-color: var(--danger-color);
}

.form-control::placeholder {
    color: var(--gray-400);
}

/* 警告框样式 */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
    font-weight: 500;
}

.alert-success {
    background-color: #f0fff4;
    color: #166534;
    border-left-color: var(--success-color);
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border-left-color: var(--danger-color);
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border-left-color: var(--warning-color);
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border-left-color: var(--primary-color);
}

/* 商品展示样式 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.product-card {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background-color: var(--white-color);
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    height: 220px;
    background-color: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 1rem;
}

.product-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 70%, rgba(0, 0, 0, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-image::after {
    opacity: 1;
}

.no-image {
    color: var(--gray-500);
    font-style: italic;
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

.product-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
    height: 3rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.product-intro {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    height: 2.5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.sale-price {
    color: var(--primary-color);
    font-weight: bold;
}

.original-price {
    text-decoration: line-through;
    color: var(--gray-400);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.product-actions {
    margin-top: auto;
    display: flex;
    gap: 0.75rem;
}

.product-actions .btn {
    flex: 1;
    padding: 0.65rem;
    font-size: 0.9rem;
}

/* 购物车样式 */
.cart-table {
    width: 100%;
    background-color: var(--white-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.cart-item-row {
    display: flex;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background-color 0.2s ease;
}

.cart-item-row:hover {
    background-color: var(--gray-50);
}

.cart-item-row:last-child {
    border-bottom: none;
}

.cart-item-select {
    width: 5%;
}

.cart-item-product {
    width: 35%;
    display: flex;
    align-items: center;
}

.cart-item-price {
    width: 20%;
    font-weight: 500;
}

.cart-item-quantity {
    width: 20%;
}

.cart-item-subtotal {
    width: 15%;
    font-weight: 600;
    color: var(--primary-color);
}

.cart-item-action {
    width: 5%;
}

.product-image-thumb {
    width: 80px;
    height: 80px;
    background-color: var(--gray-100);
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.product-image-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    background-color: var(--gray-100);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.25rem;
    line-height: 1;
}

.quantity-btn:hover {
    background-color: var(--gray-200);
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    padding: 0.5rem;
    font-weight: 500;
}

.quantity-input:focus {
    outline: none;
}

.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--white-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

.total-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 表格样式 */
.table {
    width: 100%;
    background-color: var(--white-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th,
.table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.actions {
    display: flex;
    gap: 0.5rem;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    gap: 0.25rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    color: var(--gray-700);
    transition: var(--transition);
    background-color: var(--white-color);
}

.pagination a:hover:not(.active) {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
}

.pagination .active {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 页脚样式 */
.footer {
    background-color: var(--gray-900);
    color: var(--gray-300);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer a {
    color: var(--gray-300);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--white-color);
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-800);
    text-align: center;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white-color);
    margin-bottom: 1rem;
    display: inline-block;
}

.footer-heading {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--white-color);
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .nav-container {
        gap: 1rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-links li {
        margin: 0.25rem;
    }
    
    .user-actions {
        width: 100%;
        justify-content: center;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .cart-table {
        display: block;
        overflow-x: auto;
    }
    
    .cart-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .form-control {
        padding: 0.65rem 0.875rem;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .product-image {
        height: 180px;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .footer-top {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* 辅助类 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 2rem; }